package com.iluwatar.doubleadapter;

/**
 * 外观设计模式，将众多复杂的接口及对象封装到一起只对外暴露出简单的接口，避免太多的接口或者对象相互耦合到一起。便于程序的维护及扩展。缺点是包装类会增加很多，增大程序体积，降低开发速度。
 */
public class MacBook {
    private Computer computer;
    private String mColor;

    public MacBook(String color) {
        mColor = color;
        computer = new Computer();
        Keyboard keyboard = new Keyboard();
        HDMIDisplay displayer = new HDMIDisplay();
        DisplayAdapter adapter = new DisplayAdapter(displayer);
        computer.plugInVGADisplayer(adapter);
        computer.plugInKeyboard(keyboard);
    }

    public void input(String text) {
        computer.input("我是一个" + mColor + "MacBook" + text);
    }

}
